package day19;

import java.util.Scanner;

/**
 * 汽水瓶
 *
 * @author wileda
 * @date 2023/03/26  21:01
 */
public class Solution {
        public static void main(String[] args) {
            Scanner scanner = new Scanner(System.in);
            while (scanner.hasNext()) {
                int num = scanner.nextInt();
                int count = 0;
                if(num == 0){
                    break;
                }
                while (num >= 3) {
                    count += num / 3;
                    num = num % 3 + num / 3;
                }
                if (num == 2) {
                    count++;

                }
                System.out.println(count);
            }
        }
    }
